home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / other / dopus412-gpl / program / main1.c < prev    next >
C/C++ Source or Header  |  2000-02-28  |  3KB  |  110 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. #include "dopus.h"
  32.  
  33. readsetup(file)
  34. char *file;
  35. {
  36.     struct ConfigStuff cstuff;
  37.     char *s;
  38.     int a;
  39.  
  40.     strcpy(str_config_file,file);
  41.     strcpy(str_config_basename,file);
  42.     if ((s=strstri(BaseName(str_config_basename),".CFG"))) *s=0;
  43.  
  44.     fixcstuff(&cstuff);
  45.     if ((a=ReadConfig(file,&cstuff))!=1) DefaultConfig(&cstuff);
  46.     cstufffix(&cstuff);
  47.  
  48.     if (a==1) {
  49.         dopus_curgadbank=dopus_firstgadbank;
  50.         data_gadgetrow_offset=data_drive_offset=0;
  51.         CheckConfig(&cstuff);
  52.     }
  53.     config_changed=0;
  54.     return(a);
  55. }
  56.  
  57. savesetup()
  58. {
  59.     struct ConfigStuff cstuff;
  60.     int a;
  61.  
  62.     fixcstuff(&cstuff);
  63.     if (!status_iconified && status_publicscreen && Window) {
  64.         if (MainScreen) {
  65.             config->scr_winx=Window->LeftEdge;
  66.             config->scr_winy=Window->TopEdge;
  67.         }
  68.         else {
  69.             config->wbwinx=Window->LeftEdge;
  70.             config->wbwiny=Window->TopEdge;
  71.         }
  72.     }
  73.     a=SaveConfig(str_config_file,&cstuff);
  74.     cstufffix(&cstuff);
  75.     if (a) config_changed=0;
  76.     return(a);
  77. }
  78.  
  79. void getdefaultconfig()
  80. {
  81.     struct ConfigStuff cstuff;
  82.  
  83.     fixcstuff(&cstuff);
  84.     DefaultConfig(&cstuff);
  85.     cstufffix(&cstuff);
  86.     config_changed=0;
  87. }
  88.  
  89. void fixcstuff(cstuff)
  90. struct ConfigStuff *cstuff;
  91. {
  92.     cstuff->config=config;
  93.     cstuff->typekey=filetype_key;
  94.     cstuff->firsttype=dopus_firsttype;
  95.     cstuff->firstbank=dopus_firstgadbank;
  96.     cstuff->curbank=dopus_curgadbank;
  97.     cstuff->firsthotkey=dopus_firsthotkey;
  98. }
  99.  
  100. void cstufffix(cstuff)
  101. struct ConfigStuff *cstuff;
  102. {
  103.     config=cstuff->config;
  104.     filetype_key=cstuff->typekey;
  105.     dopus_firsttype=cstuff->firsttype;
  106.     dopus_firstgadbank=cstuff->firstbank;
  107.     dopus_curgadbank=cstuff->curbank;
  108.     dopus_firsthotkey=cstuff->firsthotkey;
  109. }
  110.